package edu.cque.hello;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Hua
 * @create 2022-03-25 19:59
 */
/*

普通get方式: http://localhost:8080/user/inser?id=1&name=zs&age=23
restfull方式:
 */
@RequestMapping("user")
@RestController
public class UserController {
//    get方式解析  http:localhost:8080/user/inser?id=1&name=zs&age=23
    @RequestMapping("inser")
    public void insert(Integer id, String name, Integer age) {
        System.out.println("id = " + id + ", name = " + name + ", age = " + age);

    }
//解析restfull数据  http://localhost:8080/user/inser2/1/zs/23
    @RequestMapping("inser2/{id}/{name}/{c}")
    public void insert2(@PathVariable("c") Integer id, @PathVariable String name,@PathVariable("id") Integer age) {
        System.out.println("id = " + id + ", name = " + name + ", age = " + age);

    }


}
